package com.cc.learning.service.impl;

import com.cc.learning.dao.UserInfoMapper;
import com.cc.learning.po.UserInfoPo;
import com.cc.learning.service.UserInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2017/4/6.
 */
@Service("userInfoService")
public class UserInfoServiceImpl  implements UserInfoService{
    @Resource
    private UserInfoMapper userInfoMapper;

    public int addUserInfo(UserInfoPo userInfoPo) {

        return userInfoMapper.insert(userInfoPo);
    }

    public UserInfoPo getUserInfo(UserInfoPo userInfoPo) {

        return userInfoMapper.selectOne(userInfoPo);
    }

    public int modifyUserInfo(UserInfoPo userInfoPo) {
        return userInfoMapper.update(userInfoPo);
    }

    public int deleteUserInfo(UserInfoPo userInfoPo) {
        return userInfoMapper.delete(userInfoPo);
    }

    public void deleteUsers(String[] ids) {
        UserInfoPo userInfoPo;
        for (String id :ids){
            userInfoPo = new UserInfoPo();
            userInfoPo.setId(id);
            userInfoMapper.delete(userInfoPo);
        }
    }

    public List<UserInfoPo> listUserInfo(UserInfoPo userInfoPo) {
        return  userInfoMapper.selectList(userInfoPo);
    }
}
